<template>
  <el-header class="home-header">
    <div class="logo">
      <img src="../../assets/images/logo.jpg" alt="">
      <span>静态页生成系统</span>
    </div>
    <div class="user-info">
      您好, {{getusername}},
      <el-link type="primary" @click="logout">[ 退出 ]</el-link>
    </div>
  </el-header>
</template>
<script>
export default {
  name: 'commonHeader',
  computed: {
    getusername () {
      return window.sessionStorage.getItem('username')
    }
  },
  methods: {
    logout () {
      window.sessionStorage.clear()
      this.$router.push('/')
    }
  }
}
</script>
<style lang="scss" scoped>
.home-header {
  background-color: #373d41;
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  .logo {
    display: flex;
    align-items: center;
    padding: 2px 5px 0;
    box-sizing: border-box;
    height: 60px;
    img {
      width: 56px;
      border-radius: 50%;
    }
    span {
      margin-left: 15px;
    }
  }
  .user-info {
    color: #fff;
  }
}
</style>
